package com.qdlc.p2p.manage.action;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Action;

import com.opensymphony.xwork2.ModelDriven;
import com.qdlc.p2p.biz.service.AccountBankService;
import com.qdlc.p2p.biz.web.action.BaseAction;
import com.qdlc.p2p.common.util.StringUtil;
import com.qdlc.p2p.dal.common.model.jpa.PageDataList;
import com.qdlc.p2p.dal.model.AccountBankModel;

public class ManageAccountBankAction extends BaseAction<AccountBankModel> implements ModelDriven<AccountBankModel> {

	@Resource
	private AccountBankService accountBankservice;

	private Map<String, Object> data;


	/**
	 * 用户银行卡列表页面
	 * 
	 * @return
	 * @throws Exception
	 */
	@Action("/modules/account/cash/accountbank/accountBankManager")
	public String accountBankManager() throws Exception {
		return "accountBankManager";
	}

	/**
	 * 用户银行卡列表
	 * 
	 * @return
	 * @throws Exception
	 */
	@Action("/modules/account/cash/accountbank/accountBankList")
	public void accountBankList() throws Exception {
		data = new HashMap<String, Object>();
		int pageNumber = paramInt("page"); // 当前页数
		int pageSize = paramInt("rows"); // 每页每页总数
		if(StringUtil.isBlank(paramString("status"))){
			model.setStatus(99);
		}
		PageDataList<AccountBankModel> accountBankList = accountBankservice
				.accountBankList(model, pageNumber, pageSize);
		data.put("total", accountBankList.getPage().getTotal()); // 总行数
		data.put("rows", accountBankList.getList()); // 集合对象
		printJson(getStringOfJpaObj(data));
	}

}
